package teamGiga.action;

import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import teamGiga.bean.TheaterRoomBean;
import teamGiga.dao.MovieDao;
import action.servlet.ActionForWard;

public class TrAction extends Action{
	private String path;
	private boolean redirect;
	public TrAction(String path, boolean redirect) {
		super();
		this.path = path;
		this.redirect = redirect;
	}
	public TrAction() {
		super();
	}
	@Override
	public ActionForWard execute(HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		try {
			HashMap<Object, Object>mlist=new HashMap<Object, Object>();
			mlist.put("trnum", request.getParameter("trnum"));
			mlist.put("tno", request.getParameter("tno"));
			List<TheaterRoomBean> trList=MovieDao.getTr(mlist);
			request.setAttribute("trnum",trList.get(0).getTrnum());
			String[]donseat=request.getParameter("scapacity").split("/");
			String[]capa=trList.get(0).getCapacity().split("/");
			request.setAttribute("capa",capa);
			request.setAttribute("donseat", donseat);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return new ActionForWard(path, redirect);
	}
	
}
